package com.kongjs.application.convert;

import com.kongjs.application.model.dto.*;
import com.kongjs.application.model.entity.Roles;
import com.kongjs.application.model.vo.QueryRoleParamVO;
import com.kongjs.application.model.vo.QueryRoleVO;
import com.kongjs.application.model.vo.SaveRoleVO;
import com.kongjs.application.model.vo.UpdateRoleVO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.ReportingPolicy;

import java.util.List;

@Mapper(componentModel = "spring",unmappedSourcePolicy = ReportingPolicy.IGNORE,unmappedTargetPolicy = ReportingPolicy.IGNORE)
public interface RolesConverter {
    SaveRoleDTO toDto(SaveRoleVO vo);
    UpdateRoleDTO toDto(UpdateRoleVO vo);
    Roles toEntity(SaveRoleDTO dto);
    Roles toEntity(UpdateRoleDTO dto);
    @Mapping(target = "menuIds",ignore = true)
    QueryRoleDTO toDto(Roles roles);
    List<QueryRoleVO> toVos(List<QueryRoleDTO> dtos);
    QueryRoleParamDTO toDto(QueryRoleParamVO paramVO);
    List<QueryRoleDTO> toDtos(List<Roles> roles);
    QueryRoleVO toVo(QueryRoleDTO dto);
    RoleCacheDTO toCache(Roles roles);
}
